#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
# @version: v1.0
# @author : wlis
# @Email : 19688513@qq.com
# @Project : g-carbon-bio
# @File : stock_data.py
# @Software: PyCharm
# @time: 2025/2/4 18:36
# @description :  symbol 的个股信息
"""

class StockData:
    def __init__(self, total_market_value, circulating_market_value, industry,
                 listing_date, stock_code, stock_name, total_shares, circulating_shares,
                 rating_agency=None, rating=None, rating_quarter=None, market_type=None):
        """
        初始化 StockData 实例。

        参数:
            total_market_value (float): 总市值。
            circulating_market_value (float): 流通市值。
            industry (str): 行业。
            listing_date (str): 上市时间，修改为字符串类型。
            stock_code (str): 股票代码。
            stock_name (str): 股票简称。
            total_shares (float): 总股本。
            circulating_shares (float): 流通股。
            rating_agency (str, optional): 评级机构，默认为 None。
            rating (str, optional): 评级，默认为 None。
            rating_quarter (str, optional): 评级季度，默认为 None。
            market_type (str, optional): 市场类型（如沪 A 股、深 A 股、京 A 股、新股），默认为 None。
        """
        self._total_market_value = total_market_value
        self._circulating_market_value = circulating_market_value
        self._industry = industry
        self._listing_date = listing_date  # 保持字符串类型
        self._stock_code = stock_code
        self._stock_name = stock_name
        self._total_shares = total_shares
        self._circulating_shares = circulating_shares
        self._rating_agency = rating_agency
        self._rating = rating
        self._rating_quarter = rating_quarter
        self._market_type = market_type  # 新增字段

    @property
    def market_type(self):
        """获取市场类型。"""
        return self._market_type

    @market_type.setter
    def market_type(self, value):
        """设置市场类型。"""
        self._market_type = value

    @property
    def total_market_value(self):
        return self._total_market_value

    @total_market_value.setter
    def total_market_value(self, value):
        self._total_market_value = value

    @property
    def circulating_market_value(self):
        return self._circulating_market_value

    @circulating_market_value.setter
    def circulating_market_value(self, value):
        self._circulating_market_value = value

    @property
    def industry(self):
        return self._industry

    @industry.setter
    def industry(self, value):
        self._industry = value

    @property
    def listing_date(self):
        return self._listing_date  # 保持为字符串类型

    @listing_date.setter
    def listing_date(self, value):
        self._listing_date = value  # 保持为字符串类型

    @property
    def stock_code(self):
        return self._stock_code

    @stock_code.setter
    def stock_code(self, value):
        self._stock_code = value

    @property
    def stock_name(self):
        return self._stock_name

    @stock_name.setter
    def stock_name(self, value):
        self._stock_name = value

    @property
    def total_shares(self):
        return self._total_shares

    @total_shares.setter
    def total_shares(self, value):
        self._total_shares = value

    @property
    def circulating_shares(self):
        return self._circulating_shares

    @circulating_shares.setter
    def circulating_shares(self, value):
        self._circulating_shares = value

    @property
    def rating_agency(self):
        return self._rating_agency

    @rating_agency.setter
    def rating_agency(self, value):
        self._rating_agency = value

    @property
    def rating(self):
        return self._rating

    @rating.setter
    def rating(self, value):
        self._rating = value

    @property
    def rating_quarter(self):
        return self._rating_quarter

    @rating_quarter.setter
    def rating_quarter(self, value):
        self._rating_quarter = value

    def __str__(self):
        return (f"股票代码: {self.stock_code}, 股票名称: {self.stock_name}, "
                f"总市值: {self.total_market_value}, 流通市值: {self.circulating_market_value}, "
                f"行业: {self.industry}, 上市时间: {self.listing_date}, "
                f"总股本: {self.total_shares}, 流通股: {self.circulating_shares}, "
                f"评级机构: {self.rating_agency}, 评级: {self.rating}, "
                f"评级季度: {self.rating_quarter}, 市场类型: {self.market_type}")


